package org.deng.learn.basic.extendslearn;

/**
 * @author DengLibin
 * @Description
 * @Date 2018/12/6 0006 15:52
 */
public class Father {

    static {
        System.out.println("父类静态代码块1");
    }
    private static int age = 10;
    static {
        System.out.println("父类静态代码块2 age="+age);
    }

    //静态代码块的执行和静态变量的初始化按顺序执行


    //构造代码块优先构造函数执行
    //构造代码块的执行和实例变量的初始化按顺序执行


    {
        System.out.println("父类构造代码块1");
    }

    public  Father(){
        System.out.println("父类构造方法name="+name);
        show();
    }
    private String name = "大兵";
    {
        System.out.println("父类构造代码块2="+name);
    }

    public    void show(){
        System.out.println(this.getClass().getName());
        System.out.println("父类name = "+this.name);
    }
}
